<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .tex {
            border: 1px solid black;
            margin: 10px;
        }
        
        .text {
            float: right;
        }
        
        .text1 {
            float: left;
        }
    </style>
</head>

<body>
    <div class="tex text">
        <p>text</p>
        <div class="clear" style="clear:both;"></div>
    </div>
    <div class="tex text1">
        <p>text2</p>
        <div class="clear" style="clear:both;"></div>
    </div>
</body>

</html>